import { unref } from 'vue'
const defaultGlobalNamespace: string = 'win'
const parseNamespace = (element: string, property?: string) => {
  let cls = '--' + defaultGlobalNamespace
  if (element) {
    cls += `-${unref(element)}`
  }
  if (property && property !== '') {
    cls += `--${unref(property)}`
  }
  return cls
}
const useNamespace = (element: string) => {
  /** @description element get组件种类class*/
  const e = () => {
    return parseNamespace(element, '')
  }
  /** @description property get组件专属propertyclass(非泛用class)*/
  const p = (property: string) => {
    return property ? parseNamespace(element, property) : ''
  }
  const is = (key: string, value: boolean) => {
    return value ? key : ''
  }
  return {
    e,
    p,
    is
    // useProps
  }
}
export default useNamespace
